// 基础题库所有请求

import request from '@/utils/request'

// 获取所有基础题库列表
export function getQuestions(params) {
  return request({
    url: '/questions',
    method: 'get',
    params
  })
}
// 基础题库详情
export function getQuestionsDetails(id) {
  return request({
    url: '/questions/' + id,
    method: 'get'
  })
}
// 添加基础题库
export function addQuestions(data) {
  return request({
    url: '/questions',
    method: 'post',
    data
  })
}

// 基础题库修改
export function editQuestions(data) {
  return request({
    url: '/questions/' + data.id,
    method: 'put',
    data
  })
}
// 基础题库删除
export function delQuestions(id) {
  return request({
    url: '/questions/' + id,
    method: 'delete'
  })
}

// 加入或移除精选
export function joinQuestions(data) {
  return request({
    url: `/questions/choice/${data.id}/${data.choiceState}`,
    method: 'patch',
    data
  })
}

// 学科列表  subjects/simple
export const getSimpleInfo = () =>
  request({
    url: '/subjects/simple/',
    method: 'GET'
  })
// 获取二级目录
export const getSecondLevelDirectory = (params) =>
  request({
    url: '/directorys/simple/',
    method: 'GET',
    params
  })
// 获取标签
export const getTag = (params) =>
  request({
    url: '/tags/simple/',
    method: 'GET',
    params
  })
